package com.zq.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zq.product.dao.entity.ProductSpec;
import com.zq.product.mapper.ProductSpecMapper;
import com.zq.product.service.IProductSpecService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * <p>
 * 商品规格 服务实现类
 * </p>
 *
 * @author 张乔
 * @since 2025-05-13
 */
@Service
public class ProductSpecServiceImpl extends ServiceImpl<ProductSpecMapper, ProductSpec> implements IProductSpecService {

//    分页查询
    @Override
    public PageInfo<ProductSpec> getAllPage(Integer page, Integer limit,String name) {


        PageHelper.startPage(page, limit);
        List<ProductSpec> list = this.list(new LambdaQueryWrapper<ProductSpec>().
                like(StringUtils.hasText(name),ProductSpec::getSpecName, name));

        PageInfo<ProductSpec> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }




}
